package com.wk.provider;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.List;

import javax.ws.rs.ext.ParamConverter;
import javax.ws.rs.ext.ParamConverterProvider;
import javax.ws.rs.ext.Provider;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Provider
@Component
public class StringListParamConverterProvider<T> implements ParamConverterProvider{

	
	@Autowired
	private ListConverter<T> converter;

	@Override
	public <T> ParamConverter<T> getConverter(Class<T> rawType,
			Type genericType, Annotation[] annotations) {
		if (rawType.equals(List.class)) {
			return (ParamConverter<T>) converter;
		}
		return null;
	}
	
	

}
